//
//  CLSeverTool.h
//  toroBracelet
//
//  Created by 丁益 on 16/7/20.
//  Copyright © 2016年 celi. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface CLSeverTool : NSObject

SingletonH(SeverTool)
typedef enum {
    ALPHA = 0,
    BLUE = 1,
    GREEN = 2,
    RED = 3
} PIXELS;

+ (void)editSaveToPhotosFlag:(BOOL)flag;

+ (NSString *)getFilePath:(NSString *)fileName;
/** 是否有保存图片到相册*/
+ (BOOL)getSaveToPhotosFlag;
+ (void)saveTokenToUserFile:(NSString *)nToken;
+ (NSString *)getTokenFromUserFile;

+ (NSString *)getUsedAccount;
+ (BOOL)saveUsedAccount:(NSString *)accountString;

/** 保存是否成功登录过*/
+ (void)saveHasLoginStats:(BOOL)loginStats;
/** 获取是否成功登录过状态*/
+ (BOOL)getHasLoginStats;
/** 保存是否加载过个人信息引导页*/
+ (void)saveSettingProFileStats:(BOOL)settingProFileStats;
/** 获取个人信息引导页状态*/
+ (BOOL)getSettingProFileStats;

- (UIImage *)convertToGrayscale:(UIImage *)source;

#pragma mark - 图片处理
+ (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize;
+ (UIImage *)resizeImage:(UIImage *)srcImage toSize:(CGSize)dstSize;

#pragma mark - alertView统一接口, 由于iOS8之后有点击alert进行界面跳转操作时候会产生界面bug，因此进行接口封装
/**
 *  显示alertView，并给定相应的操作例如: 返回上级控制器（此时会出现界面的bug）
 *
 *  @param vc          当前所在控制器
 *  @param title       主标题
 *  @param message     副标题
 *  @param cancelTitle 取消按钮的标题
 *  @param okTitle     确定按钮的标题
 *  @param cancelBlock 取消按钮绑定的操作
 *  @param okBlock     确定按钮绑定的操作
 */
+ (void)showAlertViewInViewController:(UIViewController *)vc withTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle okButtonTitle:(NSString *)okTitle cancelBlock:(void(^)())cancelBlock okBlock:(void(^)())okBlock;

#pragma mark - alertView接口, 只在当前控制器显示alertView，不进行跳转操作,可以使用以下统一接口
/**
 *  只在当前控制器显示alertView，点击后没有界面跳转操作
 */
+ (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle okButtonTitle:(NSString *)okTitle cancelBlock:(void(^)())cancelBlock okBlock:(void(^)())okBlock;

/**
 *  只在当前控制器显示alertView,支持3个选择按钮，点击后没有界面跳转操作
 */
+ (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle oneButtonTitle:(NSString *)oneButtonTitle twoButtonTitle:(NSString *)twoButtonTitle cancelBlock:(void(^)())cancelBlock oneBlock:(void(^)())oneBlock twoBlock:(void(^)())twoBlock;

/**
 *  只有一个点击事件，在上一个AlertView没消失之前只弹出一次
 */
+ (void)showAlertViewWithTitle:(NSString *)title  oneButtonTitle:(NSString *)oneButtonTitle oneBlock:(void (^)())oneBlock;

/**
 *  当返回结果r=400时，系统将会弹出重新登录对话框
 */
+ (BOOL) alertViewWithResponse:(id)responseObject;


/**
 *  网络连接失败的提示框,默认的网络连接失败提示语
 */
+ (void)showNetErrorAlert;
/**
 *  显示message
 */
+ (void)showAlertWithMessage:(NSString *)message;
/**
 *  显示title
 */
+ (void)showAlertWithTitle:(NSString *)title;
/**
 *  显示title, message
 */
+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message;
@end
